import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/home/Index.vue";
import Question from "../views/home/Question.vue";
import ManagerHome from "../views/manager/ManagerHome.vue";
import RecordList from "../views/manager/ExamRecord.vue";
import RecordDetails from "../views/manager/RecordDetails.vue";

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter);

const routes = [
	{
		path: "/",
		name: "Home",
		component: Home,
	},
	{
		path: "/wjdc",
		name: "Home",
		component: Home,
	},
	{
		path: "/wjdc/:id",
		name: "Question",
		component: Question,
		props: true
	},
	{
		path: "/manager/wjdc/:examId",
		name: "ManagerHome",
		component: ManagerHome,
		props: true
	},
	{
		path: "/manager/record/:examId",
		name: "RecordList",
		component: RecordList,
		props: true
	},
	{
		path: "/manager/details/:examId/:wenquanId",
		name: "RecordDetails",
		component: RecordDetails,
		props: true
	},
];

const router = new VueRouter({
	mode: "hash",
	base: "/dcwj/",
	routes,
});

export default router;
